Problem: $f(x, y) = \left( -\cos(x), -y\sin(x) \right)$ $\text{div}(f) = $
Answer: The formula for divergence in two dimensions is $\text{div}(f) = \dfrac{\partial P}{\partial x} + \dfrac{\partial Q}{\partial y}$, where $P$ is the $x$ -component of $f$ and $Q$ is the $y$ -component. Let's differentiate! $\begin{aligned} \dfrac{\partial P}{\partial x} &= \dfrac{\partial}{\partial x} \left[ -\cos(x) \right] \\ \\ &= \sin(x) \\ \\ \dfrac{\partial Q}{\partial y} &= \dfrac{\partial}{\partial y} \left[ -y\sin(x) \right] \\ \\ &= -\sin(x) \end{aligned}$ Adding the two partial derivatives, $\text{div}(f) = 0$.